package newcommerce.data
{
	public class MediaData extends AbstractMediaData
	{
		protected var _width:Number = 425;
		protected var _height:Number = 320;
		protected var _image:String;
		protected var _mini:String;
		protected var _info:String;
		protected var _creator:String;
		protected var _rating:Number;
		protected var _yourRating:Number;
		protected var _download:String;
		protected var _embed:String;
		
		public function set download(download:String):void
		{
			_download = download;
		}
		
		public function get download():String
		{
			return _download;
		}
		
		public function set embed(embed:String):void
		{
			_embed = embed;
		}
		
		public function get embed():String
		{
			return _embed;
		}

		public function set yourRating(yourRating:Number):void
		{
			_yourRating = yourRating;
		}

		public function get yourRating():Number
		{
			return _yourRating;
		}

		public function set creator(creator:String):void
		{
			_creator = creator;
		}

		public function get creator():String
		{
			return _creator;
		}

		public function get rating():Number
		{
			return _rating;
		}

		public function set rating(rating:Number):void
		{
			_rating = rating;
		}

		public function get mini():String
		{
			return _mini;
		}

		public function set mini(mini:String):void
		{
			_mini = mini;
		}

		public function set image(image:String):void
		{
			_image = image;
		}

		public function get image():String
		{
			return _image;
		}

		public function set info(info:String):void
		{
			_info = info;
		}

		public function get info():String
		{
			return _info;
		}
		
		public function get height():Number
		{
			return _height;
		}

		public function get width():Number
		{
			return _width;
		}

		public function MediaData(id:Number = -1, title:String = "", duration:Number = 0, uri:String = "", image:String = "")
		{
			super(id, title, duration, uri, "");
			_image = image;
		}

		public static function fromXML(xml:XML):MediaData
		{
			var media:MediaData = new MediaData(parseInt(xml.identifier.text()), xml.title.text(), 0, xml.location.text(), xml.image.text());
			media.creator = xml.creator.text();
			media.info = xml.info.text();
			media.rating = xml.rating.text()
			media.tn = xml.thumbnail.text();
			media.mini = xml.mini.text();
			media.download = xml.download.text();
			media.embed = xml.embed.text();
			
			return media;
		}
		
		public static function fromXMLList(xml:XMLList):MediaData
		{
			var media:MediaData = new MediaData(parseInt(xml.identifier.text()), xml.title.text(), 0, xml.location.text(), xml.image.text());
			media.creator = xml.creator.text();
			media.info = xml.info.text();
			media.rating = xml.rating.text()
			media.tn = xml.thumbnail.text();
			media.mini = xml.mini.text();
			media.download = xml.download.text();
			media.embed = xml.embed.text();
			
			return media;
		}
	}
}
